{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def DFS(x, y):\n",
    "#     if check(x, y):\n",
    "#         return\n",
    "#     else:\n",
    "#         for i in range(0,4):\n",
    "#             xt = dx[i] + x\n",
    "#             yt = dy[i] + y\n",
    "#             if dp(xt, yt):\n",
    "#                 continue\n",
    "#             else:\n",
    "#                 global resCount\n",
    "#                 col[xt-1] -= 1\n",
    "#                 rol[yt-1] -= 1\n",
    "#                 flag[xt-1][yt-1] = 1\n",
    "#                 resx[resCount] = xt\n",
    "#                 resy[resCount] = yt\n",
    "#                 resCount += 1\n",
    "#                 DFS(xt, yt)\n",
    "#                 col[xt-1] += 1\n",
    "#                 rol[yt-1] += 1\n",
    "#                 resCount -= 1\n",
    "#                 flag[xt-1][yt-1] = 0\n",
    "# def dp(x, y):\n",
    "#     global n\n",
    "#     if x < 1 or x > n:\n",
    "#         return True\n",
    "#     elif y < 1 or y > n:\n",
    "#         return True\n",
    "#     elif col[x-1] < 0 or rol[y-1] < 0:\n",
    "#         return True\n",
    "#     elif flag[x-1][y-1] == 1:\n",
    "#         return True\n",
    "#     else:\n",
    "#         return False\n",
    "# def check(x, y):\n",
    "#     global n\n",
    "#     if x == n and y == n:\n",
    "#         for i in range(1, n+1):\n",
    "#             if rol[i-1] != 0 or col[i-1] != 0:\n",
    "#                 return 0\n",
    "#         for i in range(1, resCount+1):\n",
    "#             summ = n*(resx[i-1] - 1) + resy[i - 1]\n",
    "#             print(summ, end=' ')\n",
    "#         return 1\n",
    "#     return 0\n",
    "# n = int(input())\n",
    "# resx = [[0]for i in range(n) for j in range(n)]\n",
    "# resy = [[0]for i in range(n) for j in range(n)]\n",
    "# resx[0] = 1\n",
    "# resy[0] = 1\n",
    "# flag = [[0]*n for i in range(n)]\n",
    "# dx = [0,1,-1,0]\n",
    "# dy = [1,0,0,-1]\n",
    "#\n",
    "# flag[0][0] = 1\n",
    "# #我们的入口就是第一个所以将第一个设置成1\n",
    "# resCount = 1\n",
    "# col = list(map(int, input().split()))\n",
    "# rol = list(map(int, input().split()))\n",
    "# col[0] -= 1\n",
    "# rol[0] -= 1\n",
    "# DFS(1,1)"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
